function GAD_Etom_cdf_plot_pv(Data_Summary)
%% WT saline data
G18_saline_PV = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'G2_F4_18') && strcmp(Data_Summary(n).drug,'saline')  && isempty(G18_saline_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G18_saline_PV = PV;
        G18_saline_Shuffle = PV_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'G2_F4_18') && strcmp(Data_Summary(n).drug,'saline')   && ~isempty(G18_saline_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G18_saline_PV = cat(1,G18_saline_PV,PV);
        G18_saline_Shuffle = cat(1,G18_saline_Shuffle,PV_Shuffle);
    end
end
[G18sf,G18sx,G18slow,G18shigh] = ecdf(G18_saline_PV,'Function','cdf','Alpha',0.05);
[G18ssf,G18ssx,G18sslow,G18sshigh] = ecdf(G18_saline_Shuffle,'Function','cdf','Alpha',0.05);

G28_saline_PV = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'G2_F5(2)_28') && strcmp(Data_Summary(n).drug,'saline')  && isempty(G28_saline_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G28_saline_PV = PV;
        G28_saline_Shuffle = PV_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'G2_F5(2)_28') && strcmp(Data_Summary(n).drug,'saline')   && ~isempty(G28_saline_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G28_saline_PV = cat(1,G28_saline_PV,PV);
        G28_saline_Shuffle = cat(1,G28_saline_Shuffle,PV_Shuffle);
    end
end
[G28sf,G28sx,G28slow,G28shigh] = ecdf(G28_saline_PV,'Function','cdf','Alpha',0.05);
[G28ssf,G28ssx,G28sslow,G28sshigh] = ecdf(G28_saline_Shuffle,'Function','cdf','Alpha',0.05);

G31_saline_PV = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'G2_F5(2)_31') && strcmp(Data_Summary(n).drug,'saline')  && isempty(G31_saline_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G31_saline_PV = PV;
        G31_saline_Shuffle = PV_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'G2_F5(2)_31') && strcmp(Data_Summary(n).drug,'saline')   && ~isempty(G31_saline_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G31_saline_PV = cat(1,G31_saline_PV,PV);
        G31_saline_Shuffle = cat(1,G31_saline_Shuffle,PV_Shuffle);
    end
end
[G31sf,G31sx,G31slow,G31shigh] = ecdf(G31_saline_PV,'Function','cdf','Alpha',0.05);
[G31ssf,G31ssx,G31sslow,G31sshigh] = ecdf(G31_saline_Shuffle,'Function','cdf','Alpha',0.05);

G34_saline_PV = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'G2_F5(2)_34') && strcmp(Data_Summary(n).drug,'saline')  && isempty(G34_saline_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G34_saline_PV = PV;
        G34_saline_Shuffle = PV_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'G2_F5(2)_34') && strcmp(Data_Summary(n).drug,'saline')   && ~isempty(G34_saline_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G34_saline_PV = cat(1,G34_saline_PV,PV);
        G34_saline_Shuffle = cat(1,G34_saline_Shuffle,PV_Shuffle);
    end
end
[G34sf,G34sx,G34slow,G34shigh] = ecdf(G34_saline_PV,'Function','cdf','Alpha',0.05);
[G34ssf,G34ssx,G34sslow,G34sshigh] = ecdf(G34_saline_Shuffle,'Function','cdf','Alpha',0.05);

%% Organize data for WT saline

% get WT saline CDF mean
A = cat(1,G18sf,G28sf,G31sf,G34sf);
WT_saline_F = sort(A);

% get WT saline CDF x-steps
B = cat(1,G18sx,G28sx,G31sx,G34sx);
WT_saline_X = sort(B);

% get WT saline CDF high bound mean
C = cat(1,G18shigh,G28shigh,G31shigh,G34shigh);
WT_saline_H = sort(C);

% get WT saline CDF low bound mean
D = cat(1,G18slow,G28slow,G31slow,G34slow);
WT_saline_L = sort(D);

%% MUT saline data
G17_saline_PV = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'G2_F4_17') && strcmp(Data_Summary(n).drug,'saline')  && isempty(G17_saline_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G17_saline_PV = PV;
        G17_saline_Shuffle = PV_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'G2_F4_17') && strcmp(Data_Summary(n).drug,'saline')   && ~isempty(G17_saline_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G17_saline_PV = cat(1,G17_saline_PV,PV);
        G17_saline_Shuffle = cat(1,G17_saline_Shuffle,PV_Shuffle);
    end
end
[G17sf,G17sx,G17slow,G17shigh] = ecdf(G17_saline_PV,'Function','cdf','Alpha',0.05);
[G17ssf,G17ssx,G17sslow,G17sshigh] = ecdf(G17_saline_Shuffle,'Function','cdf','Alpha',0.05);

G21_saline_PV = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'G2_F5(2)_21') && strcmp(Data_Summary(n).drug,'saline')  && isempty(G21_saline_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G21_saline_PV = PV;
        G21_saline_Shuffle = PV_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'G2_F5(2)_21') && strcmp(Data_Summary(n).drug,'saline')   && ~isempty(G21_saline_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G21_saline_PV = cat(1,G21_saline_PV,PV);
        G21_saline_Shuffle = cat(1,G21_saline_Shuffle,PV_Shuffle);
    end
end
[G21sf,G21sx,G21slow,G21shigh] = ecdf(G21_saline_PV,'Function','cdf','Alpha',0.05);
[G21ssf,G21ssx,G21sslow,G21sshigh] = ecdf(G21_saline_Shuffle,'Function','cdf','Alpha',0.05);

G45_saline_PV = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'G2_F5(2)_45') && strcmp(Data_Summary(n).drug,'saline')  && isempty(G45_saline_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G45_saline_PV = PV;
        G45_saline_Shuffle = PV_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'G2_F5(2)_45') && strcmp(Data_Summary(n).drug,'saline')   && ~isempty(G45_saline_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G45_saline_PV = cat(1,G45_saline_PV,PV);
        G45_saline_Shuffle = cat(1,G45_saline_Shuffle,PV_Shuffle);
    end
end
[G45sf,G45sx,G45slow,G45shigh] = ecdf(G45_saline_PV,'Function','cdf','Alpha',0.05);
[G45ssf,G45ssx,G45sslow,G45sshigh] = ecdf(G45_saline_Shuffle,'Function','cdf','Alpha',0.05);

G53_saline_PV = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'G2_F5(2)_53') && strcmp(Data_Summary(n).drug,'saline')  && isempty(G53_saline_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G53_saline_PV = PV;
        G53_saline_Shuffle = PV_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'G2_F5(2)_53') && strcmp(Data_Summary(n).drug,'saline')   && ~isempty(G53_saline_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G53_saline_PV = cat(1,G53_saline_PV,PV);
        G53_saline_Shuffle = cat(1,G53_saline_Shuffle,PV_Shuffle);
    end
end
[G53sf,G53sx,G53slow,G53shigh] = ecdf(G53_saline_PV,'Function','cdf','Alpha',0.05);
[G53ssf,G53ssx,G53sslow,G53sshigh] = ecdf(G53_saline_Shuffle,'Function','cdf','Alpha',0.05);


%% Organize data for MUT saline

% get MUT saline CDF mean
A = cat(1,G17sf,G21sf,G45sf,G53sf);
MUT_saline_F = sort(A);

% get MUT saline CDF x-steps
B = cat(1,G17sx,G21sx,G45sx,G53sx);
MUT_saline_X = sort(B);

% get MUT saline CDF high bound mean
C = cat(1,G17shigh,G21shigh,G45shigh,G53shigh);
MUT_saline_H = sort(C);

% get MUT saline CDF low bound mean
D = cat(1,G17slow,G21slow,G45slow,G53slow);
MUT_saline_L = sort(D);

%% WT etom 7mg/kg data
G18_etom7_PV = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'G2_F4_18') && strcmp(Data_Summary(n).drug,'etomidate 7mg/kg')  && isempty(G18_etom7_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G18_etom7_PV = PV;
        G18_etom7_Shuffle = PV_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'G2_F4_18') && strcmp(Data_Summary(n).drug,'etomidate 7mg/kg')   && ~isempty(G18_etom7_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G18_etom7_PV = cat(1,G18_etom7_PV,PV);
        G18_etom7_Shuffle = cat(1,G18_etom7_Shuffle,PV_Shuffle);
    end
end
[G18e7f,G18e7x,G18e7low,G18e7high] = ecdf(G18_etom7_PV,'Function','cdf','Alpha',0.05);
[G18se7f,G18se7x,G18se7low,G18se7high] = ecdf(G18_etom7_Shuffle,'Function','cdf','Alpha',0.05);

G28_etom7_PV = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'G2_F5(2)_28') && strcmp(Data_Summary(n).drug,'etomidate 7mg/kg')  && isempty(G28_etom7_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G28_etom7_PV = PV;
        G28_etom7_Shuffle = PV_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'G2_F5(2)_28') && strcmp(Data_Summary(n).drug,'etomidate 7mg/kg')   && ~isempty(G28_etom7_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G28_etom7_PV = cat(1,G28_etom7_PV,PV);
        G28_etom7_Shuffle = cat(1,G28_etom7_Shuffle,PV_Shuffle);
    end
end
[G28e7f,G28e7x,G28e7low,G28e7high] = ecdf(G28_etom7_PV,'Function','cdf','Alpha',0.05);
[G28se7f,G28se7x,G28se7low,G28se7high] = ecdf(G28_etom7_Shuffle,'Function','cdf','Alpha',0.05);

G31_etom7_PV = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'G2_F5(2)_31') && strcmp(Data_Summary(n).drug,'etomidate 7mg/kg')  && isempty(G31_etom7_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G31_etom7_PV = PV;
        G31_etom7_Shuffle = PV_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'G2_F5(2)_31') && strcmp(Data_Summary(n).drug,'etomidate 7mg/kg')   && ~isempty(G31_etom7_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G31_etom7_PV = cat(1,G31_etom7_PV,PV);
        G31_etom7_Shuffle = cat(1,G31_etom7_Shuffle,PV_Shuffle);
    end
end
[G31e7f,G31e7x,G31e7low,G31e7high] = ecdf(G31_etom7_PV,'Function','cdf','Alpha',0.05);
[G31se7f,G31se7x,G31se7low,G31se7high] = ecdf(G31_etom7_Shuffle,'Function','cdf','Alpha',0.05);

G34_etom7_PV = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'G2_F5(2)_34') && strcmp(Data_Summary(n).drug,'etomidate 7mg/kg')  && isempty(G34_etom7_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G34_etom7_PV = PV;
        G34_etom7_Shuffle = PV_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'G2_F5(2)_34') && strcmp(Data_Summary(n).drug,'etomidate 7mg/kg')   && ~isempty(G34_etom7_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G34_etom7_PV = cat(1,G34_etom7_PV,PV);
        G34_etom7_Shuffle = cat(1,G34_etom7_Shuffle,PV_Shuffle);
    end
end
[G34e7f,G34e7x,G34e7low,G34e7high] = ecdf(G34_etom7_PV,'Function','cdf','Alpha',0.05);
[G34se7f,G34se7x,G34se7low,G34se7high] = ecdf(G34_etom7_Shuffle,'Function','cdf','Alpha',0.05);

%% Organize data for WT Etom 7mg/kg

% get WT etom7 CDF mean
A = cat(1,G18e7f,G28e7f,G31e7f,G34e7f);
WT_etom7_F = sort(A);

% get WT etom7 CDF x-steps
B = cat(1,G18e7x,G28e7x,G31e7x,G34e7x);
WT_etom7_X = sort(B);

% get WT etom7 CDF high bound mean
C = cat(1,G18e7high,G28e7high,G31e7high,G34e7high);
WT_etom7_H = sort(C);

% get WT etom7 CDF low bound mean
D = cat(1,G18e7low,G28e7low,G31e7low,G34e7low);
WT_etom7_L = sort(D);

%% MUT etom 7mg/kg data
G17_etom7_PV = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'G2_F4_17') && strcmp(Data_Summary(n).drug,'etomidate 7mg/kg')  && isempty(G17_etom7_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G17_etom7_PV = PV;
        G17_etom7_Shuffle = PV_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'G2_F4_17') && strcmp(Data_Summary(n).drug,'etomidate 7mg/kg')   && ~isempty(G17_etom7_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G17_etom7_PV = cat(1,G17_etom7_PV,PV);
        G17_etom7_Shuffle = cat(1,G17_etom7_Shuffle,PV_Shuffle);
    end
end
[G17e7f,G17e7x,G17e7low,G17e7high] = ecdf(G17_etom7_PV,'Function','cdf','Alpha',0.05);
[G17se7f,G17se7x,G17se7low,G17se7high] = ecdf(G17_etom7_Shuffle,'Function','cdf','Alpha',0.05);

G21_etom7_PV = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'G2_F5(2)_21') && strcmp(Data_Summary(n).drug,'etomidate 7mg/kg')  && isempty(G21_etom7_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G21_etom7_PV = PV;
        G21_etom7_Shuffle = PV_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'G2_F5(2)_21') && strcmp(Data_Summary(n).drug,'etomidate 7mg/kg')   && ~isempty(G21_etom7_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G21_etom7_PV = cat(1,G21_etom7_PV,PV);
        G21_etom7_Shuffle = cat(1,G21_etom7_Shuffle,PV_Shuffle);
    end
end
[G21e7f,G21e7x,G21e7low,G21e7high] = ecdf(G21_etom7_PV,'Function','cdf','Alpha',0.05);
[G21se7f,G21se7x,G21se7low,G21se7high] = ecdf(G21_etom7_Shuffle,'Function','cdf','Alpha',0.05);

G45_etom7_PV = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'G2_F5(2)_45') && strcmp(Data_Summary(n).drug,'etomidate 7mg/kg')  && isempty(G45_etom7_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G45_etom7_PV = PV;
        G45_etom7_Shuffle = PV_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'G2_F5(2)_45') && strcmp(Data_Summary(n).drug,'etomidate 7mg/kg')   && ~isempty(G45_etom7_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G45_etom7_PV = cat(1,G45_etom7_PV,PV);
        G45_etom7_Shuffle = cat(1,G45_etom7_Shuffle,PV_Shuffle);
    end
end
[G45e7f,G45e7x,G45e7low,G45e7high] = ecdf(G45_etom7_PV,'Function','cdf','Alpha',0.05);
[G45se7f,G45se7x,G45se7low,G45se7high] = ecdf(G45_etom7_Shuffle,'Function','cdf','Alpha',0.05);

G53_etom7_PV = [];
for n = 1:size(Data_Summary,2)
    if strcmp(Data_Summary(n).animalName, 'G2_F5(2)_53') && strcmp(Data_Summary(n).drug,'etomidate 7mg/kg')  && isempty(G53_etom7_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G53_etom7_PV = PV;
        G53_etom7_Shuffle = PV_Shuffle;
    elseif strcmp(Data_Summary(n).animalName, 'G2_F5(2)_53') && strcmp(Data_Summary(n).drug,'etomidate 7mg/kg')   && ~isempty(G53_etom7_PV)
        [PV, PV_Shuffle] = get_PV_values_ready(Data_Summary(n).PV_Corr_Values, Data_Summary(n).Shuffled_PV_Corr, Data_Summary(n).PV_Corr_Coherent_Rot);
        G53_etom7_PV = cat(1,G53_etom7_PV,PV);
        G53_etom7_Shuffle = cat(1,G53_etom7_Shuffle,PV_Shuffle);
    end
end
[G53e7f,G53e7x,G53e7low,G53e7high] = ecdf(G53_etom7_PV,'Function','cdf','Alpha',0.05);
[G53se7f,G53se7x,G53se7low,G53se7high] = ecdf(G53_etom7_Shuffle,'Function','cdf','Alpha',0.05);


%% Organize data for MUT Etom 7mg/kg

% get MUT etom7 CDF mean
A = cat(1,G17e7f,G21e7f,G45e7f,G53e7f);
MUT_etom7_F = sort(A);

% get MUT etom7 CDF x-steps
B = cat(1,G17e7x,G21e7x,G45e7x,G53e7x);
MUT_etom7_X = sort(B);

% get MUT etom7 CDF high bound mean
C = cat(1,G17e7high,G21e7high,G45e7high,G53e7high);
MUT_etom7_H = sort(C);

% get MUT etom7 CDF low bound mean
D = cat(1,G17e7low,G21e7low,G45e7low,G53e7low);
MUT_etom7_L = sort(D);

%% Finally, put shuffle data together

% get shuffle CDF mean
A = cat(1,G17ssf,G21ssf,G45ssf,G53ssf,G18ssf,G28ssf,G31ssf,G34ssf,G17se7f,G18se7f,G21se7f,G28se7f,G31se7f,G34se7f,G45se7f,G53se7f);
Shuffle_F = sort(A);

% get shuffle CDF x-steps
B = cat(1,G17ssx,G21ssx,G45ssx,G53ssx,G18ssx,G28ssx,G31ssx,G34ssx,G17se7x,G18se7x,G21se7x,G28se7x,G31se7x,G34se7x,G45se7x,G53se7x);
Shuffle_X = sort(B);

% get shuffle CDF high bound mean
C = cat(1,G17sshigh,G21sshigh,G45sshigh,G53sshigh,G18sshigh,G28sshigh,G31sshigh,G34sshigh,G17se7high,G18se7high,G21se7high,G28se7high,G31se7high,G34se7high,G45se7high,G53se7high);
Shuffle_H = sort(C);

% get shuffle CDF low bound mean
D = cat(1,G17sslow,G21sslow,G45sslow,G53sslow,G18sslow,G28sslow,G31sslow,G34sslow,G17se7low,G18se7low,G21se7low,G28se7low,G31se7low,G34se7low,G45se7low,G53se7low);
Shuffle_L = sort(D);

%% plot all data

figure
subplot(1,4,1)
plot(WT_saline_X,WT_saline_F,'Color','#1750AC','LineWidth',3);
hold on
% % plot(WT_saline_X,WT_saline_L,'--k','LineWidth',1);
% % hold on
% % plot(WT_saline_X,WT_saline_H,'--k','LineWidth',1);
% % hold on
plot(MUT_saline_X,MUT_saline_F,'Color','#F53BD6','LineWidth',3);
hold on
% % plot(MUT_saline_X,MUT_saline_L,'--k','LineWidth',1);
% % hold on
% % plot(MUT_saline_X,MUT_saline_H,'--k','LineWidth',1);
% % hold on
plot(Shuffle_X,Shuffle_F,'-k','LineWidth',3);
hold on
% % plot(Shuffle_X,Shuffle_L,'--k','LineWidth',1);
% % hold on
% % plot(Shuffle_X,Shuffle_H,'--k','LineWidth',1);
% % hold on
% % legend('p-WT Saline','','','\alpha5-i-KO Saline','','','Shuffle','95% Confidence Interval','','Location','southeast');
xlabel('PV Correlation Value')
ylabel('Cumulative Fraction of Locations')
xlim([-0.6,1])
set(gca,'FontSize',10)
set(gca, 'visible', 'off')
hold off

subplot(1,4,2)
plot(WT_saline_X,WT_saline_F,'Color','#1750AC','LineWidth',3);
hold on
% % plot(WT_saline_X,WT_saline_L,'--k','LineWidth',1);
% % hold on
% % plot(WT_saline_X,WT_saline_H,'--k','LineWidth',1);
% % hold on
plot(WT_etom7_X,WT_etom7_F,'Color','#73B9EE' ,'LineWidth',3);
hold on
% % plot(WT_etom7_X,WT_etom7_L,'--k','LineWidth',1);
% % hold on
% % plot(WT_etom7_X,WT_etom7_H,'--k','LineWidth',1);
% % hold on
plot(Shuffle_X,Shuffle_F,'-k','LineWidth',3);
hold on
% % plot(Shuffle_X,Shuffle_L,'--k','LineWidth',1);
% % hold on
% % plot(Shuffle_X,Shuffle_H,'--k','LineWidth',1);
% % hold on
% % legend('p-WT Saline','','','p-WT Etom 7mg/kg','','','Location','southeast');
xlabel('PV Correlation Value')
ylabel('Cumulative Fraction of Locations')
xlim([-0.6,1])
set(gca,'FontSize',10)
set(gca, 'visible', 'off')
hold off

subplot(1,4,3)
plot(MUT_saline_X,MUT_saline_F,'Color','#F53BD6','LineWidth',3);
hold on
% % plot(MUT_saline_X,MUT_saline_L,'--k','LineWidth',1);
% % hold on
% % plot(MUT_saline_X,MUT_saline_H,'--k','LineWidth',1);
% % hold on
plot(MUT_etom7_X,MUT_etom7_F,'Color','#FA9CEA' ,'LineWidth',3);
hold on
% % plot(MUT_etom7_X,MUT_etom7_L,'--k','LineWidth',1);
% % hold on
% % plot(MUT_etom7_X,MUT_etom7_H,'--k','LineWidth',1);
% % hold on
plot(Shuffle_X,Shuffle_F,'-k','LineWidth',3);
hold on
% % plot(Shuffle_X,Shuffle_L,'--k','LineWidth',1);
% % hold on
% % plot(Shuffle_X,Shuffle_H,'--k','LineWidth',1);
% % hold on
% % legend('\alpha5-i-KO Saline','','','\alpha5-i-KO Etom 7mg/kg','','','Location','southeast');
xlabel('PV Correlation Value')
ylabel('Cumulative Fraction of Locations')
xlim([-0.6,1])
set(gca,'FontSize',10)
set(gca, 'visible', 'off')
hold off

subplot(1,4,4)
plot(WT_etom7_X,WT_etom7_F,'Color','#73B9EE' ,'LineWidth',3);
hold on
% % plot(WT_etom7_X,WT_etom7_L,'--k','LineWidth',1);
% % hold on
% % plot(WT_etom7_X,WT_etom7_H,'--k','LineWidth',1);
% % hold on
plot(MUT_etom7_X,MUT_etom7_F,'Color','#FA9CEA' ,'LineWidth',3);
hold on
% % plot(MUT_etom7_X,MUT_etom7_L,'--k','LineWidth',1);
% % hold on
% % plot(MUT_etom7_X,MUT_etom7_H,'--k','LineWidth',1);
% % hold on
plot(Shuffle_X,Shuffle_F,'-k','LineWidth',3);
hold on
% % plot(Shuffle_X,Shuffle_L,'--k','LineWidth',1);
% % hold on
% % plot(Shuffle_X,Shuffle_H,'--k','LineWidth',1);
% % hold on
% % legend('p-WT Etom 7mg/kg','','','\alpha5-i-KO Etom 7mg/kg','','','Location','southeast');
xlabel('PV Correlation Value')
ylabel('Cumulative Fraction of Locations')
xlim([-0.6,1])
set(gca,'FontSize',10)
set(gca, 'visible', 'off')
hold off


% % %% Clean Up
% % cutoff = -0.1;
% % index = nan(size(WT_saline_X,1),1);
% % for n = 1:size(WT_saline_X,1)
% %     if WT_saline_X(n,1) >= cutoff
% %         index(n,1) = n;
% %     end
% % end
% % index = min(index);
% % WT_saline_F = WT_saline_F(index:end,1);
% % 
% % index = nan(size(WT_etom7_X,1),1);
% % for n = 1:size(WT_etom7_X,1)
% %     if WT_etom7_X(n,1) >= cutoff
% %         index(n,1) = n;
% %     end
% % end
% % index = min(index);
% % WT_etom7_F = WT_etom7_F(index:end,1);
% % 
% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % 
% % index = nan(size(MUT_saline_X,1),1);
% % for n = 1:size(MUT_saline_X,1)
% %     if MUT_saline_X(n,1) >= cutoff
% %         index(n,1) = n;
% %     end
% % end
% % index = min(index);
% % MUT_saline_F = MUT_saline_F(index:end,1);
% % 
% % index = nan(size(MUT_etom7_X,1),1);
% % for n = 1:size(MUT_etom7_X,1)
% %     if MUT_etom7_X(n,1) >= cutoff
% %         index(n,1) = n;
% %     end
% % end
% % index = min(index);
% % MUT_etom7_F = MUT_etom7_F(index:end,1);
% % 
% % %% Further clean up
% % 
% % index = nan(size(G18sx,1),1);
% % for n = 1:size(G18sx,1)
% %     if G18sx(n,1) >= cutoff
% %         index(n,1) = n;
% %     end
% % end
% % index = min(index);
% % G18sf = G18sf(index:end,1);
% % 
% % index = nan(size(G28sx,1),1);
% % for n = 1:size(G28sx,1)
% %     if G28sx(n,1) >= cutoff
% %         index(n,1) = n;
% %     end
% % end
% % index = min(index);
% % G28sf = G28sf(index:end,1);
% % 
% % index = nan(size(G31sx,1),1);
% % for n = 1:size(G31sx,1)
% %     if G31sx(n,1) >= cutoff
% %         index(n,1) = n;
% %     end
% % end
% % index = min(index);
% % G31sf = G31sf(index:end,1);
% % 
% % index = nan(size(G34sx,1),1);
% % for n = 1:size(G34sx,1)
% %     if G34sx(n,1) >= cutoff
% %         index(n,1) = n;
% %     end
% % end
% % index = min(index);
% % G34sf = G34sf(index:end,1);
% % 
% % 
% % %%%%%%%%%%%%%%%%%%%
% % %%%%%%%%%%%%%%%%%%%
% % 
% % index = nan(size(G17sx,1),1);
% % for n = 1:size(G17sx,1)
% %     if G17sx(n,1) >= cutoff
% %         index(n,1) = n;
% %     end
% % end
% % index = min(index);
% % G17sf = G17sf(index:end,1);
% % 
% % index = nan(size(G21sx,1),1);
% % for n = 1:size(G21sx,1)
% %     if G21sx(n,1) >= cutoff
% %         index(n,1) = n;
% %     end
% % end
% % index = min(index);
% % G21sf = G21sf(index:end,1);
% % 
% % index = nan(size(G45sx,1),1);
% % for n = 1:size(G45sx,1)
% %     if G45sx(n,1) >= cutoff
% %         index(n,1) = n;
% %     end
% % end
% % index = min(index);
% % G45sf = G45sf(index:end,1);
% % 
% % index = nan(size(G53sx,1),1);
% % for n = 1:size(G53sx,1)
% %     if G53sx(n,1) >= cutoff
% %         index(n,1) = n;
% %     end
% % end
% % index = min(index);
% % G53sf = G53sf(index:end,1);
% % 
% % 
% % 
% % %% Perform KS statistics tests
% % 
% % % test difference between wt saline & mut saline
% % [test_result1, p_value1] = kstest2(WT_saline_F,MUT_saline_F);
% % if test_result1 == 0
% %     disp('WT vs MUT saline are not different')
% % elseif test_result1 == 1
% %     disp('WT vs MUT saline are different')
% % end
% % p1 = string(p_value1);
% % disp(strcat('WT vs MUT saline KS test p-value =',{' '}, p1));
% % 
% % % test between wt saline & wt etom 7mg/kg
% % [test_result2, p_value2] = kstest2(WT_saline_F,WT_etom7_F);
% % if test_result2 == 0
% %     disp('WT saline vs WT ETOM 7mg/kg are not different')
% % elseif test_result2 == 1
% %     disp('WT saline vs WT ETOM 7mg/kg are different')
% % end
% % p2 = string(p_value2);
% % disp(strcat('WT saline vs WT ETOM 7mg/kg KS test p-value =',{' '}, p2));
% % 
% % % test between mut saline & mut etom 7mg/kg
% % [test_result3, p_value3] = kstest2(MUT_saline_F,MUT_etom7_F);
% % if test_result3 == 0
% %     disp('MUT saline vs MUT ETOM 7mg/kg are not different')
% % elseif test_result3 == 1
% %     disp('MUT saline vs MUT ETOM 7mg/kg are different')
% % end
% % p3 = string(p_value3);
% % disp(strcat('MUT saline vs MUT ETOM 7mg/kg KS test p-value =',{' '}, p3));
% % 
% % % test difference between wt saline & mut etom 7mg/kg
% % [test_result4, p_value4] = kstest2(WT_etom7_F,MUT_etom7_F);
% % if test_result4 == 0
% %     disp('WT vs MUT ETOM 7mg/kg are not different')
% % elseif test_result4 == 1
% %     disp('WT vs MUT ETOM 7mg/kg are different')
% % end
% % p4 = string(p_value4);
% % disp(strcat('WT vs MUT ETOM 7mg/kg KS test p-value =',{' '}, p4));




% % %% Get some KS-statistics (everything in reference to WT Saline Mean) and perform 2-way ANOVA 
% % 
% % % get WT saline KS-statistics
% % [~,~,G18sKS] = kstest2(WT_saline_F, G18sf);
% % [~,~,G28sKS] = kstest2(WT_saline_F, G28sf);
% % [~,~,G31sKS] = kstest2(WT_saline_F, G31sf);
% % [~,~,G34sKS] = kstest2(WT_saline_F, G34sf);
% % 
% % % get MUT saline KS-statistics
% % [~,~,G17sKS] = kstest2(WT_saline_F, G17sf);
% % [~,~,G21sKS] = kstest2(WT_saline_F, G21sf);
% % [~,~,G45sKS] = kstest2(WT_saline_F, G45sf);
% % [~,~,G53sKS] = kstest2(WT_saline_F, G53sf);
% % 
% % % get WT ETOM 7mg/kg KS-statistics
% % [~,~,G18e7KS] = kstest2(WT_saline_F, G18e7f);
% % [~,~,G28e7KS] = kstest2(WT_saline_F, G28e7f);
% % [~,~,G31e7KS] = kstest2(WT_saline_F, G31e7f);
% % [~,~,G34e7KS] = kstest2(WT_saline_F, G34e7f);
% % 
% % % get MUT ETOM 7mg/kg KS-statistics
% % [~,~,G17e7KS] = kstest2(WT_saline_F, G17e7f);
% % [~,~,G21e7KS] = kstest2(WT_saline_F, G21e7f);
% % [~,~,G45e7KS] = kstest2(WT_saline_F, G45e7f);
% % [~,~,G53e7KS] = kstest2(WT_saline_F, G53e7f);
% % 
% % % Plot the KS statistics
% % figure
% % A = categorical({'p-WT Saline'});
% % B = categorical({'\alpha5-i-KO Saline'});
% % C = categorical({'p-WT ETOM 7mg/kg'});
% % D = categorical({'\alpha5-i-KO ETOM 7mg/kg'});
% % X = cat(2,A,B,C,D);
% % X = reordercats(X, {'p-WT Saline','\alpha5-i-KO Saline','p-WT ETOM 7mg/kg','\alpha5-i-KO ETOM 7mg/kg'});
% % Y(1,1) = mean([G18sKS,G28sKS,G31sKS,G34sKS]);
% % Y(1,2) = mean([G17sKS,G21sKS,G45sKS,G53sKS]);
% % Y(1,3) = mean([G18e7KS,G28e7KS,G31e7KS,G34e7KS]);
% % Y(1,4) = mean([G17e7KS,G21e7KS,G45e7KS,G53e7KS]);
% % h=bar(X(1,1),Y(1,1),0.2,'LineWidth',1.2,'FaceColor','flat','FaceAlpha',0.5);
% % h.CData(1,:) = [0 0 1]; % color up each individual bar
% % ylabel('KS-statistics (vs. p-WT Saline Mean)');
% % hold on
% % h=bar(X(1,2),Y(1,2),0.2,'LineWidth',1.2,'FaceColor','flat','FaceAlpha',0.5);
% % h.CData(1,:) = [0 1 0]; % color up each individual bar
% % hold on
% % h=bar(X(1,3),Y(1,3),0.2,'LineWidth',1.2,'FaceColor','flat','FaceAlpha',0.5);
% % h.CData(1,:) = [1 0 0]; % color up each individual bar
% % hold on
% % h=bar(X(1,4),Y(1,4),0.2,'LineWidth',1.2,'FaceColor','flat','FaceAlpha',0.5);
% % h.CData(1,:) = [1 0 1]; % color up each individual bar
% % hold on
% % err(1,1)=std([G18sKS,G28sKS,G31sKS,G34sKS]);
% % err(1,2)=std([G17sKS,G21sKS,G45sKS,G53sKS]);
% % err(1,3)=std([G18e7KS,G28e7KS,G31e7KS,G34e7KS]);
% % err(1,4)=std([G17e7KS,G21e7KS,G45e7KS,G53e7KS]);
% % er = errorbar(X,Y,[],err,'LineWidth',3);    
% % er.Color = [0 0 0];                            
% % er.LineStyle = 'None'; 
% % set(gca,'FontSize',10);
% % hold on
% % scatter(A,G18sKS,70,'o','k','LineWidth',3);
% % hold on
% % scatter(A,G28sKS,70,'^','k','LineWidth',3);
% % hold on
% % scatter(A,G31sKS,70,'s','k','LineWidth',3);
% % hold on
% % scatter(A,G34sKS,70,'d','k','LineWidth',3);
% % hold on
% % scatter(B,G17sKS,70,'>','k','LineWidth',3);
% % hold on
% % scatter(B,G21sKS,70,'<','k','LineWidth',3);
% % hold on
% % scatter(B,G45sKS,70,'*','k','LineWidth',3);
% % hold on
% % scatter(B,G53sKS,70,'h','k','LineWidth',3);
% % hold on
% % scatter(C,G18e7KS,70,'o','k','LineWidth',3);
% % hold on
% % scatter(C,G28e7KS,70,'^','k','LineWidth',3);
% % hold on
% % scatter(C,G31e7KS,70,'s','k','LineWidth',3);
% % hold on
% % scatter(C,G34e7KS,70,'d','k','LineWidth',3);
% % hold on
% % scatter(D,G17e7KS,70,'>','k','LineWidth',3);
% % hold on
% % scatter(D,G21e7KS,70,'<','k','LineWidth',3);
% % hold on
% % scatter(D,G45e7KS,70,'*','k','LineWidth',3);
% % hold on
% % scatter(D,G53e7KS,70,'h','k','LineWidth',3);
% % ylim([0,0.008])
% % hold off
% % 
% % % perform 2-way ANOVA
% % % Data table organized as: 
% % % column = drug conditions (saline & ETOM 7mg/kg)
% % % row = genotypes (p-WT & MUT), four animals of each genotype
% % % Therefore the data table is 8-by-2
% % 
% % WT_saline_KS = ([G18sKS,G28sKS,G31sKS,G34sKS]);
% % MUT_saline_KS = ([G17sKS,G21sKS,G45sKS,G53sKS]);
% % WT_etom7_KS = ([G18e7KS,G28e7KS,G31e7KS,G34e7KS]);
% % MUT_etom7_KS = ([G17e7KS,G21e7KS,G45e7KS,G53e7KS]);
% % 
% % KS_Summary(:,1) = cat(1,WT_saline_KS(:),MUT_saline_KS(:));
% % KS_Summary(:,2) = cat(1,WT_etom7_KS(:),MUT_etom7_KS(:));
% % 
% % [KS_p_value,KS_anova_table] = anova2(KS_Summary,4);


end